/**
 * SpringMVC restful 风格
 * 云市场控制器，控制关于云市场的一些业务逻辑操作
 * @author yanwl
 * @date 2014-08-20
 */
package com.chnbst.bstyun.controller.user;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.chnbst.bstyun.core.common.Pager;
import com.chnbst.bstyun.core.common.SignUtil;
import com.chnbst.bstyun.model.pojo.Industry;
import com.chnbst.bstyun.model.pojo.Meal;
import com.chnbst.bstyun.model.pojo.Menu;
import com.chnbst.bstyun.model.pojo.Product;
import com.chnbst.bstyun.model.pojo.ProductCategory;
import com.chnbst.bstyun.model.pojo.ProductFee;
import com.chnbst.bstyun.model.vo.MealFeeVo;
import com.chnbst.bstyun.model.vo.MealProductVo;
import com.chnbst.bstyun.model.vo.ProductDownloadVo;
import com.chnbst.bstyun.model.vo.ProductIndustryVo;
import com.chnbst.bstyun.service.IndustryService;
import com.chnbst.bstyun.service.MealFeeService;
import com.chnbst.bstyun.service.MealProductService;
import com.chnbst.bstyun.service.MealService;
import com.chnbst.bstyun.service.MenuService;
import com.chnbst.bstyun.service.ProductCategoryService;
import com.chnbst.bstyun.service.ProductDownloadService;
import com.chnbst.bstyun.service.ProductFeeService;
import com.chnbst.bstyun.service.ProductService;

@Controller
@RequestMapping("/mall")
public class CloundMarketController {
	/**
	 * 页数
	 */
	private int page = 1;
	/**
	 * 增值服务套餐每页显示的条数
	 */
	private int zzfwPageSize = 8;
	/**
	 * 个人应用套餐每页显示的条数
	 */
	private int gryyPageSize = 6;
	
	
	/**
	 * 注入 业务逻辑层
	 */
	@Autowired
	private MenuService menuService;
	@Autowired
	private ProductService productService;
	@Autowired
	private MealService mealService;
	@Autowired
	private MealProductService mealProductService;
	@Autowired
	private ProductCategoryService productCategoryService;
	@Autowired
	private IndustryService industryService;
	@Autowired
	private MealFeeService mealFeeService;
	@Autowired
	private ProductFeeService productFeeService;
	@Autowired
	private ProductDownloadService productDownloadService;
	
	
	/**
	 * http://xxx.com/mall
	 * get请求 返回云市场首页
	 */
	@RequestMapping(method=RequestMethod.GET)
	public ModelAndView cloudmarket(){
		/**
		 * 菜单显示
		 */
		List<Menu> menus = menuService.selectMenus();
		
		/**
		 * 产品行业显示
		 */
		//List<Industry> industries = industryService.selectIndustries();
		
		/**
		 * 产品类别显示
		 */
		//List<ProductCategory> productCategories = productCategoryService.selectProductCategories();
		
		
		/**
		 * 所有套餐显示
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		Map<String, Object> map1 = new HashMap<String, Object>();
		map1.put("start", 0);
		map1.put("pageSize", Integer.MAX_VALUE);
		map1.put("sortField", "m.add_time");
		map1.put("sortOrder", "asc");
		List<Meal> meals = mealService.selectMeals(map1);
		
		/**
		 * 分页查找套餐产品   分别是MC云办公商务版、MC云办公私有云、MC云办公基础版和增值服务四个套餐
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		Map<String, Object> map2 = new HashMap<String, Object>();
		map1.put("pageSize", 3);
		List<Meal> mpVo1 = mealService.selectMeals(map1);
		
		//最新应用
		map2.put("start", 0);
		map2.put("pageSize", 4);
		map2.put("sortField", "mp.add_time");
		map2.put("sortOrder", "desc");
		map2.put("mealId", 4);
		List<MealProductVo> mpVo3 = mealProductService.selectMealProductVos(map2);
		
		//增值服务
		/*if(mpVo3.size() >= 4) {
			System.out.println(mpVo3.size());
			map2.put("start", 4);
		}*/
		map2.put("sortOrder", "asc");
		List<MealProductVo> mpVo4 = mealProductService.selectMealProductVos(map2);
		
		ModelAndView mav = new ModelAndView();
		
		mav.addObject("menus", menus);
		mav.addObject("meals", meals);
		mav.addObject("mpVo1", mpVo1);
		mav.addObject("mpVo3", mpVo3);
		mav.addObject("mpVo4", mpVo4);
		mav.setViewName("mall/cloudmarket");
		return mav;
	}
	
	/**
	 * ajax请求查询云商城首页上的数据
	 * @param request
	 * @return 云商城首页上的数据集合Map
	 */
	@RequestMapping(value="/search",method=RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> indexSearch(HttpServletRequest request) {
		Integer industryId = null;
		Integer productCategoryId = null;
 
		String industryIdStr = request.getParameter("industryId");
		String productCategoryIdStr = request.getParameter("productCategoryId");
		String productName = request.getParameter("productName");
		
		if(SignUtil.isNotEmpty(industryIdStr)) {
			industryId = Integer.valueOf(industryIdStr);
		}
		if(SignUtil.isNotEmpty(productCategoryIdStr)) {
			productCategoryId = Integer.valueOf(productCategoryIdStr);
		}
		if(SignUtil.isEmpty(productName)) {
			productName = null;
		}
		
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("industryId", industryId);
		map.put("productCategoryId", productCategoryId);
		map.put("productName", productName);

		/**
		 * 分页查找套餐产品   分别是MC云办公商务版、MC云办公私有云、MC云办公基础版和增值服务四个套餐
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		Map<String, Object> map2 = new HashMap<String, Object>();
		map2.put("industryId", industryId);
		map2.put("productCategoryId", productCategoryId);
		map2.put("productName", productName);
		map2.put("start", 0);
		map2.put("pageSize", Integer.MAX_VALUE);
		map2.put("sortField", "mp.add_time");
		map2.put("sortOrder", "asc");
		
		//MC云办公商务版
		map2.put("mealId", 1);
		List<MealProductVo> mpVo2 = mealProductService.selectMealProductVos(map2);
		
		//MC云办公私有云
		map2.put("mealId", 2);
		List<MealProductVo> mpVo1 = mealProductService.selectMealProductVos(map2);
		
		//MC云办公基础版
		map2.put("mealId", 3);
		List<MealProductVo> mpVo3 = mealProductService.selectMealProductVos(map2);
		
		/**
		 * 增值服务显示（最多显示4个）
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		map2.put("sortOrder", "desc");
		map2.put("mealId", 4);
		map2.put("pageSize", 4);
		List<MealProductVo> mpVo4 = mealProductService.selectMealProductVos(map2);
		
		
		Map<String, Object> resultMap = new HashMap<String, Object>();
		resultMap.put("mpVo1", mpVo1);
		resultMap.put("mpVo2", mpVo2);
		resultMap.put("mpVo3", mpVo3);
		resultMap.put("mpVo4", mpVo4);
		
		return resultMap;
	}
		
	/**
	 * http://xxx.com/mall/tcxq
	 * get请求 返回套餐详情页面
	 */
	@RequestMapping(value="/tcxq/{mealId}",method=RequestMethod.GET)
	public ModelAndView yunbgsw(@PathVariable Integer mealId,HttpServletRequest request){
		/**
		 * 菜单显示
		 */
		List<Menu> menus = menuService.selectMenus();
		
		/**
		 * 所有套餐显示
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		Map<String, Object> map1 = new HashMap<String, Object>();
		map1.put("start", 0);
		map1.put("pageSize", Integer.MAX_VALUE);
		map1.put("sortField", "m.add_time");
		map1.put("sortOrder", "asc");
		List<Meal> meals = mealService.selectMeals(map1);
		
		/**
		 * 根据套餐编号查找套餐计费Vo
		 */
		MealFeeVo mfVo = mealFeeService.selectMealFeeVoByMealId(mealId);
		
		/**
		 * 套餐简介以“;”拆分，重新组合
		 */
		String[] strs = mfVo.getMealBrief().split(";");
		List<String> list = new ArrayList<String>();
		for (String string : strs) {
			list.add(string);
		}
		
		/**
		 * 查找套餐中的套餐产品
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("start", 0);
		map.put("pageSize", Integer.MAX_VALUE);
		map.put("sortField", "mp.add_time");
		map.put("sortOrder", "asc");
		map.put("mealId", mealId);
		List<MealProductVo> mpVo = mealProductService.selectMealProductVos(map);
		
		/**
		 * 查找套餐的下载中心
		 */
		Map<String, Object> map2 = new HashMap<String, Object>();
		map2.put("productId", 25);
		List<ProductDownloadVo> pdv = productDownloadService.selectProductDownloadVos(map2);
		
		ModelAndView mav = new ModelAndView();
		
		mav.addObject("menus", menus);
		mav.addObject("meals", meals);
		mav.addObject("mfVo", mfVo);
		mav.addObject("list", list);
		mav.addObject("mpVo", mpVo);
		mav.addObject("pdv", pdv);
		mav.addObject("requestURI", request.getRequestURI());
		mav.setViewName("mall/mealxq");
		return mav;
	}
	
	/**
	 * http://xxx.com/mall/cpxq
	 * get请求 返回产品详情页面
	 */
	@RequestMapping(value="/cpxq/{productId}",method=RequestMethod.GET)
	public ModelAndView cpxq(@PathVariable Integer productId,HttpServletRequest request){
		List<Menu> menus = menuService.selectMenus();
		
		/**
		 * 所有套餐显示
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		Map<String, Object> map1 = new HashMap<String, Object>();
		map1.put("start", 0);
		map1.put("pageSize", Integer.MAX_VALUE);
		map1.put("sortField", "m.add_time");
		map1.put("sortOrder", "asc");
		List<Meal> meals = mealService.selectMeals(map1);
		
		/*查询产品行业*/
		ProductIndustryVo product = productService.selectProductIndustryVoByProductId(productId);
		/*查询产品计费*/
		ProductFee pf = productFeeService.selectProductFeeByProductId(productId);
		
		/**
		 * 产品特点简介以“;”拆分，重新组合
		 */
		String[] strs = product.getProductSpecialtyBrief().split(";");
		List<String> list = new ArrayList<String>();
		for (String string : strs) {
			list.add(string);
		}
		
		/**
		 * 查找套餐的下载中心
		 */
		Map<String, Object> map2 = new HashMap<String, Object>();
		map2.put("productId", productId);
		List<ProductDownloadVo> pdv = productDownloadService.selectProductDownloadVos(map2);
		
		ModelAndView mav = new ModelAndView();
		
		mav.addObject("menus", menus);
		mav.addObject("meals", meals);
		mav.addObject("product", product);
		mav.addObject("pdv", pdv);
		mav.addObject("pf", pf);
		mav.addObject("list", list);
		mav.addObject("requestURI", request.getRequestURI());
		mav.setViewName("mall/productxq");
		return mav;
	}
	
	
	/**
	 * http://xxx.com/mall/yyzzfw
	 * get请求 返回应用增值服务页面
	 */
	@RequestMapping(value="/yyzzfw",method=RequestMethod.GET)
	public ModelAndView yyzzfw(HttpServletRequest request){
		/**
		 * 菜单显示
		 */
		List<Menu> menus = menuService.selectMenus();
		
		/**
		 * 产品行业显示
		 */
		List<Industry> industries = industryService.selectIndustries();
		
		/**
		 * 产品类别显示
		 */
		List<ProductCategory> productCategories = productCategoryService.selectProductCategories();
		
		/**
		 * 所有套餐显示
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		Map<String, Object> map1 = new HashMap<String, Object>();
		map1.put("start", 0);
		map1.put("pageSize", Integer.MAX_VALUE);
		map1.put("sortField", "m.add_time");
		map1.put("sortOrder", "asc");
		List<Meal> meals = mealService.selectMeals(map1);
		
		
		Map<String, Object> map2 = new HashMap<String, Object>();
		map2.put("mealId", 4);
		
		int totalRows = mealProductService.selectMealProductCount(map2);
		
		String pg = request.getParameter("page");
		if(SignUtil.isNotEmpty(pg)) {
			page = Integer.valueOf(pg);
		}else {
			page = 1;
		}
		
		/**
		 * 套餐产品总页数
		 */
		int pageCount = Pager.getPageCount(totalRows, zzfwPageSize);
		if(pageCount < page) {
			page = pageCount;
		}
		
		/**
		 * 当前页开始下标
		 */
		int start = Pager.getStart(page, zzfwPageSize);
		
		/**
		 * 分页查找增值服务套餐的套餐产品
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		map2.put("start", start);
		map2.put("pageSize", zzfwPageSize);
		map2.put("sortField", "mp.add_time");
		map2.put("sortOrder", "desc");
		List<MealProductVo> mpVo = mealProductService.selectMealProductVos(map2);
		
		
		
		ModelAndView mav = new ModelAndView();
		
		mav.addObject("menus", menus);
		mav.addObject("industries", industries);
		mav.addObject("productCategories", productCategories);
		mav.addObject("meals", meals);
		mav.addObject("totalRows", totalRows);
		mav.addObject("mpVo", mpVo);
		mav.addObject("page", page);
		mav.addObject("pageCount", pageCount);
		mav.addObject("mealId", 4);
		mav.setViewName("mall/zzfw");
		return mav;
	}
	
	/**
	 * ajax请求查询增值服务套餐详情页面上产品
	 * @param request
	 * @return 增值服务套餐套餐详情页面上产品集合Map
	 */
	@RequestMapping(value="/yyzzfw/search",method=RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> zzfwSearch(HttpServletRequest request) {
		Integer industryId = null;
		Integer productCategoryId = null;
		Integer mealId = Integer.valueOf(request.getParameter("mealId"));
		
		String industryIdStr = request.getParameter("industryId");
		String productCategoryIdStr = request.getParameter("productCategoryId");
		String productName = request.getParameter("productName");
		
		if(SignUtil.isNotEmpty(industryIdStr)) {
			industryId = Integer.valueOf(industryIdStr);
		}
		if(SignUtil.isNotEmpty(productCategoryIdStr)) {
			productCategoryId = Integer.valueOf(productCategoryIdStr);
		}
		if(SignUtil.isEmpty(productName)) {
			productName = null;
		}
		
		
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("industryId", industryId);
		map.put("productCategoryId", productCategoryId);
		map.put("productName", productName);
		map.put("mealId", mealId);
		
		
		int totalRows = mealProductService.selectMealProductCount(map);
		
		String pg = request.getParameter("page");
		if(SignUtil.isNotEmpty(pg)) {
			page = Integer.valueOf(pg);
		}else {
			page = 1;
		}
		
		/**
		 * 套餐产品总页数
		 */
		int pageCount = Pager.getPageCount(totalRows, zzfwPageSize);
		if(pageCount < page) {
			page = pageCount;
		}
		
		/**
		 * 当前页开始下标
		 */
		int start = Pager.getStart(page, zzfwPageSize);
		
		/**
		 * 分页查找增值服务套餐的套餐产品
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		map.put("start", start);
		map.put("pageSize", zzfwPageSize);
		map.put("sortField", "mp.add_time");
		map.put("sortOrder", "desc");
		
		List<MealProductVo> mpVo = mealProductService.selectMealProductVos(map);
		
		Map<String, Object> resultMap = new HashMap<String, Object>();
		resultMap.put("mpVo", mpVo);
		resultMap.put("page", page);
		resultMap.put("pageCount", pageCount);
		resultMap.put("totalRows", totalRows);
		
		return resultMap;
	}
	
	
	/**
	 * http://xxx.com/mall/gryyfw
	 * get请求 返回个人应用服务页面
	 */
	@RequestMapping(value="/gryyfw",method=RequestMethod.GET)
	public ModelAndView gryyfw(HttpServletRequest request){
		/**
		 * 菜单显示
		 */
		List<Menu> menus = menuService.selectMenus();
		
		/**
		 * 产品行业显示
		 */
		List<Industry> industries = industryService.selectIndustries();
		
		/**
		 * 产品类别显示
		 */
		List<ProductCategory> productCategories = productCategoryService.selectProductCategories();
		
		/**
		 * 所有套餐显示
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		Map<String, Object> map1 = new HashMap<String, Object>();
		map1.put("start", 0);
		map1.put("pageSize", Integer.MAX_VALUE);
		map1.put("sortField", "m.add_time");
		map1.put("sortOrder", "asc");
		List<Meal> meals = mealService.selectMeals(map1);
		
		Map<String, Object> map2 = new HashMap<String, Object>();
		map2.put("mealId", 4);
		
		int totalRows = mealProductService.selectMealProductCount(map2);
		
		String pg = request.getParameter("page");
		if(SignUtil.isNotEmpty(pg)) {
			page = Integer.valueOf(pg);
		}else {
			page = 1;
		}
		
		/**
		 * 套餐产品总页数
		 */
		int pageCount = Pager.getPageCount(totalRows, gryyPageSize);
		if(pageCount < page) {
			page = pageCount;
		}
		
		/**
		 * 当前页开始下标
		 */
		int start = Pager.getStart(page, gryyPageSize);
		
		/**
		 * 分页查找个人应用服务套餐的套餐产品
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		map2.put("start", start);
		map2.put("pageSize", gryyPageSize);
		map2.put("sortField", "mp.add_time");
		map2.put("sortOrder", "desc");
		List<MealProductVo> mpVo = mealProductService.selectMealProductVos(map2);
		
		ModelAndView mav = new ModelAndView();
		
		mav.addObject("menus", menus);
		mav.addObject("industries", industries);
		mav.addObject("productCategories", productCategories);
		mav.addObject("meals", meals);
		mav.addObject("totalRows", totalRows);
		mav.addObject("mpVo", mpVo);
		mav.addObject("page", page);
		mav.addObject("pageCount", pageCount);
		mav.addObject("mealId", 4);
		mav.setViewName("mall/gryy");
		return mav;
	}
	
	/**
	 * ajax请求查询个人应用服务套餐详情页面上产品
	 * @param request
	 * @return 个人应用服务套餐套餐详情页面上产品集合Map
	 */
	@RequestMapping(value="/gryyfw/search",method=RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> gryySearch(HttpServletRequest request) {
		Integer industryId = null;
		Integer productCategoryId = null;
		Integer mealId = Integer.valueOf(request.getParameter("mealId"));
		
		String industryIdStr = request.getParameter("industryId");
		String productCategoryIdStr = request.getParameter("productCategoryId");
		String productName = request.getParameter("productName");
		
		if(SignUtil.isNotEmpty(industryIdStr)) {
			industryId = Integer.valueOf(industryIdStr);
		}
		if(SignUtil.isNotEmpty(productCategoryIdStr)) {
			productCategoryId = Integer.valueOf(productCategoryIdStr);
		}
		if(SignUtil.isEmpty(productName)) {
			productName = null;
		}
		
		
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("industryId", industryId);
		map.put("productCategoryId", productCategoryId);
		map.put("productName", productName);
		map.put("mealId", mealId);
		
		
		int totalRows = mealProductService.selectMealProductCount(map);
		
		String pg = request.getParameter("page");
		if(SignUtil.isNotEmpty(pg)) {
			page = Integer.valueOf(pg);
		}else {
			page = 1;
		}
		
		/**
		 * 套餐产品总页数
		 */
		int pageCount = Pager.getPageCount(totalRows, gryyPageSize);
		if(pageCount < page) {
			page = pageCount;
		}
		
		/**
		 * 当前页开始下标
		 */
		int start = Pager.getStart(page, gryyPageSize);
		
		/**
		 * 分页查找增值服务套餐的套餐产品
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		map.put("start", start);
		map.put("pageSize", gryyPageSize);
		map.put("sortField", "mp.add_time");
		map.put("sortOrder", "desc");
		
		List<MealProductVo> mpVo = mealProductService.selectMealProductVos(map);
		
		Map<String, Object> resultMap = new HashMap<String, Object>();
		resultMap.put("mpVo", mpVo);
		resultMap.put("page", page);
		resultMap.put("pageCount", pageCount);
		resultMap.put("totalRows", totalRows);
		
		return resultMap;
	}
	
	/**
	 * http://xxx.com/mall/gryy
	 * get请求 返回产品详情页面
	 */
	@RequestMapping(value="/gryy/{productId}",method=RequestMethod.GET)
	public ModelAndView gryyDatail(@PathVariable Integer productId,HttpServletRequest request){
		List<Menu> menus = menuService.selectMenus();
		
		/**
		 * 所有套餐显示
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		Map<String, Object> map1 = new HashMap<String, Object>();
		map1.put("start", 0);
		map1.put("pageSize", Integer.MAX_VALUE);
		map1.put("sortField", "m.add_time");
		map1.put("sortOrder", "asc");
		List<Meal> meals = mealService.selectMeals(map1);
		
		/*查询产品行业*/
		ProductIndustryVo product = productService.selectProductIndustryVoByProductId(productId);
		/*查询产品计费*/
		//ProductFee pf = productFeeService.selectProductFeeByProductId(productId);
		/**
		 * 产品特点简介以“;”拆分，重新组合
		 */
		String[] strs = product.getProductSpecialtyBrief().split(";");
		List<String> list = new ArrayList<String>();
		for (String string : strs) {
			list.add(string);
		}
		
		ModelAndView mav = new ModelAndView();
		
		mav.addObject("menus", menus);
		mav.addObject("meals", meals);
		mav.addObject("product", product);
		mav.addObject("requestURI", request.getRequestURI());
		mav.addObject("list", list);
		mav.setViewName("mall/gryy_detail");
		return mav;
	}
	
	/**
	 * http://xxx.com/mall/gngs
	 * get请求 返回应用功能概述页面
	 */
	@RequestMapping(value="/gngs/{productId}",method=RequestMethod.GET)
	public ModelAndView gngsDetail(@PathVariable Integer productId){
		/**
		 * 菜单显示
		 */
		List<Menu> menus = menuService.selectMenus();
		
		/**
		 * 所有套餐显示
		 * @param start 该页面的起始位置
		 * @param pageSize 每页显示的条数
		 */
		Map<String, Object> map1 = new HashMap<String, Object>();
		map1.put("start", 0);
		map1.put("pageSize", Integer.MAX_VALUE);
		map1.put("sortField", "m.add_time");
		map1.put("sortOrder", "asc");
		List<Meal> meals = mealService.selectMeals(map1);
		
		Product product = productService.selectProductByProductId(productId);
		/**
		 * 产品特点简介以“;”拆分，重新组合
		 */
		String[] strs = product.getProductSpecialtyBrief().split(";");
		List<String> list = new ArrayList<String>();
		for (String string : strs) {
			list.add(string);
		}
		
		ModelAndView mav = new ModelAndView();
		
		mav.addObject("menus", menus);
		mav.addObject("meals", meals);
		mav.addObject("product", product);
		mav.addObject("list", list);
		mav.setViewName("mall/gngs_detail");
		return mav;
	}
}
